<template>
  <div class="contact-edit">
    <header-tab>
      <span slot="left" @click="Go_back"><van-icon name="arrow-left" /></span>
      <span slot="title">新增联系人</span>
    </header-tab>
    <van-contact-edit :contact-info="editingContact" @save="onSave" />
  </div>
</template>

<script>
import { Toast } from 'vant';
import { Dialog } from 'vant';
import HeaderTab from '../components/HeaderTab.vue';
export default {
  components: { HeaderTab },

  data() {
    return { editingContact: {} };
  },
  methods: {
    onSave(contactInfo) {
      let url = `user/addlinkman`;
      // console.log(this.editingContact.name);
      let params = `userid=${sessionStorage.getItem('UserID')}&&name=${contactInfo.name}&&tel=${contactInfo.tel}`;
      this.axios.put(url, params).then(res => {
        console.log(res);
        if ((res.data.code = 200)) {
          Toast.success('新增成功');
          setTimeout(() => {
            
            this.$router.back();
          }, 2000);
        }
      });
    },
    onDelete() {},
    Go_back() {
      this.$router.go(-1);
    },
  },
  mounted() {},
};
</script>

<style lang="scss" scoped></style>
